package com.wangshouyu.mp.pay.v3.callback;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 王守钰
 * @program wsy-mp-pay
 * @date 2020年08月15日 00:58
 * @description: 支付回调
 */
public class PayCallback implements Serializable {

    /**
     * 通知ID
     */
    @SerializedName(value = "id")
    @JsonProperty(value = "id")
    @JSONField(name = "id")
    private String id;

    /**
     * 通知创建时间
     */
    @SerializedName(value = "create_time")
    @JsonProperty(value = "create_time")
    @JSONField(name = "create_time")
    private String createTime;

    /**
     * 通知类型
     */
    @SerializedName(value = "event_type")
    @JsonProperty(value = "event_type")
    @JSONField(name = "event_type")
    private String eventType;

    /**
     * 通知数据类型
     */

    @SerializedName(value = "resource_type")
    @JsonProperty(value = "resource_type")
    @JSONField(name = "resource_type")
    private String resourceType;

    /**
     * 回调摘要
     */
    @SerializedName(value = "summary")
    @JsonProperty(value = "summary")
    @JSONField(name = "summary")
    private String summary;

    /**
     * 通知数据
     */
    @SerializedName(value = "resource")
    @JsonProperty(value = "resource")
    @JSONField(name = "resource")
    private PayCallbackResource resource;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getEventType() {
        return eventType;
    }

    public void setEventType(String eventType) {
        this.eventType = eventType;
    }

    public String getResourceType() {
        return resourceType;
    }

    public void setResourceType(String resourceType) {
        this.resourceType = resourceType;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public PayCallbackResource getResource() {
        return resource;
    }

    public void setResource(PayCallbackResource resource) {
        this.resource = resource;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PayCallback that = (PayCallback) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(createTime, that.createTime) &&
                Objects.equals(eventType, that.eventType) &&
                Objects.equals(resourceType, that.resourceType) &&
                Objects.equals(summary, that.summary) &&
                Objects.equals(resource, that.resource);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, createTime, eventType, resourceType, summary, resource);
    }

    @Override
    public String toString() {
        return "PayCallback{" +
                "id='" + id + '\'' +
                ", createTime='" + createTime + '\'' +
                ", eventType='" + eventType + '\'' +
                ", resourceType='" + resourceType + '\'' +
                ", summary='" + summary + '\'' +
                ", resource=" + resource +
                '}';
    }
}
